/**
 * <p><b>Title:</b> contentController.java </p>
 * @Package com.wondertek.oes.charge.service.controller
 *//*

package com.wondertek.poms.service.controller;

import javax.servlet.http.HttpServletRequest;
import java.util.List;
import java.util.Optional;

import com.wondertek.poms.common.constant.Constants;
import com.wondertek.poms.common.controller.BaseController;
import com.wondertek.poms.common.exception.MessageCodes;
import com.wondertek.poms.common.utils.validate.ValidateFilter;
import com.wondertek.poms.common.vo.PageBean;
import com.wondertek.poms.common.vo.ResultBean;
import com.wondertek.poms.core.service.IContentService;
import com.wondertek.poms.dao.po.Content;
import com.wondertek.poms.service.vo.ContentVo;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Example;

import org.springframework.data.domain.Page;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.context.annotation.Scope;



import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;


*/
/**
 * <p><b>contentController Description:</b> Controller层实现</p>
 * @author 窦再兴
 * <p><b>DATE</b> 2020-10-21 17:28:27</p>
 *//*

@Api("")
@RestController
@Scope("prototype")
@RequestMapping(value="/content")
public class ContentController extends BaseController {
	
	@Autowired
	private IContentService contentService;
	
	@ApiOperation("列表")
	@GetMapping("/list")
	@ResponseBody
	public ResultBean list(HttpServletRequest request,
						   ContentVo contentVo,
						   @RequestParam(defaultValue="1") int page,
						   @RequestParam(defaultValue="20") int rows,
						   @RequestParam(defaultValue="updatedTime") String sidx,
						   @RequestParam(defaultValue="desc") String sord) {
		Content content = new Content();
		BeanUtils.copyProperties(contentVo, content);
		
		Page<Content> pages = contentService
				.findAll(content, page, rows, sord, sidx);
		
		return PageBean.ok(pages.getTotalPages(), pages.getTotalElements(), pages.getContent());
	}

	@ApiOperation("新增")
	@ApiImplicitParams({
		@ApiImplicitParam(name = "id", required = true),
		@ApiImplicitParam(name = "accessPlatformType", required = true),
		@ApiImplicitParam(name = "area", required = true),
		@ApiImplicitParam(name = "areaId", required = true),
		@ApiImplicitParam(name = "assetId", required = true),
		@ApiImplicitParam(name = "assist", required = true),
		@ApiImplicitParam(name = "auditionRecordsNum", required = true),
		@ApiImplicitParam(name = "author", required = true),
		@ApiImplicitParam(name = "authorizationWay", required = true),
		@ApiImplicitParam(name = "bcId", required = true),
		@ApiImplicitParam(name = "bcLicense", required = true),
		@ApiImplicitParam(name = "bcPriority", required = true),
		@ApiImplicitParam(name = "bcRatio", required = true),
		@ApiImplicitParam(name = "beginDate", required = true),
		@ApiImplicitParam(name = "blackArea", required = true),
		@ApiImplicitParam(name = "businessLicense", required = true),
		@ApiImplicitParam(name = "cacheCdnStatus", required = true),
		@ApiImplicitParam(name = "category", required = true),
		@ApiImplicitParam(name = "cdnStatus", required = true),
		@ApiImplicitParam(name = "cduration", required = true),
		@ApiImplicitParam(name = "chain", required = true),
		@ApiImplicitParam(name = "clarity", required = true),
		@ApiImplicitParam(name = "cmsId", required = true),
		@ApiImplicitParam(name = "contSourceStatus", required = true),
		@ApiImplicitParam(name = "contentId", required = true),
		@ApiImplicitParam(name = "contentLevel", required = true),
		@ApiImplicitParam(name = "contentLists", required = true),
		@ApiImplicitParam(name = "contentPlayTime", required = true),
		@ApiImplicitParam(name = "copy", required = true),
		@ApiImplicitParam(name = "copyrightCpid", required = true),
		@ApiImplicitParam(name = "copyrightObjectId", required = true),
		@ApiImplicitParam(name = "copyrightType", required = true),
		@ApiImplicitParam(name = "copyrightId", required = true),
		@ApiImplicitParam(name = "cpId", required = true),
		@ApiImplicitParam(name = "cpRatio", required = true),
		@ApiImplicitParam(name = "createTime", required = true),
		@ApiImplicitParam(name = "creatorId", required = true),
		@ApiImplicitParam(name = "detail", required = true),
		@ApiImplicitParam(name = "detailCopy", required = true),
		@ApiImplicitParam(name = "directRecFlag", required = true),
		@ApiImplicitParam(name = "displayFileLists", required = true),
		@ApiImplicitParam(name = "displayName", required = true),
		@ApiImplicitParam(name = "displayType", required = true),
		@ApiImplicitParam(name = "distResult", required = true),
		@ApiImplicitParam(name = "docName", required = true),
		@ApiImplicitParam(name = "doubanId", required = true),
		@ApiImplicitParam(name = "endDate", required = true),
		@ApiImplicitParam(name = "feeType", required = true),
		@ApiImplicitParam(name = "formType", required = true),
		@ApiImplicitParam(name = "gslbStatus", required = true),
		@ApiImplicitParam(name = "hasMoved", required = true),
		@ApiImplicitParam(name = "hasVideo", required = true),
		@ApiImplicitParam(name = "images", required = true),
		@ApiImplicitParam(name = "influence", required = true),
		@ApiImplicitParam(name = "integrity", required = true),
		@ApiImplicitParam(name = "isMultiScreen", required = true),
		@ApiImplicitParam(name = "isSupH264", required = true),
		@ApiImplicitParam(name = "isSupRchd", required = true),
		@ApiImplicitParam(name = "isSupRms", required = true),
		@ApiImplicitParam(name = "isSupWap", required = true),
		@ApiImplicitParam(name = "isSupWww", required = true),
		@ApiImplicitParam(name = "isUpdating", required = true),
		@ApiImplicitParam(name = "keyWords", required = true),
		@ApiImplicitParam(name = "keywordsCopy", required = true),
		@ApiImplicitParam(name = "labels", required = true),
		@ApiImplicitParam(name = "lastModifyTime", required = true),
		@ApiImplicitParam(name = "liveType", required = true),
		@ApiImplicitParam(name = "mediaFileLists", required = true),
		@ApiImplicitParam(name = "mediaLevel", required = true),
		@ApiImplicitParam(name = "miguPublish", required = true),
		@ApiImplicitParam(name = "miguRank", required = true),
		@ApiImplicitParam(name = "monthPricing", required = true),
		@ApiImplicitParam(name = "movieLibId", required = true),
		@ApiImplicitParam(name = "name", required = true),
		@ApiImplicitParam(name = "nameCopy", required = true),
		@ApiImplicitParam(name = "nCpid", required = true),
		@ApiImplicitParam(name = "needDrm", required = true),
		@ApiImplicitParam(name = "onlineTime", required = true),
		@ApiImplicitParam(name = "optimal", required = true),
		@ApiImplicitParam(name = "oriPublish", required = true),
		@ApiImplicitParam(name = "output", required = true),
		@ApiImplicitParam(name = "playbillFilePath", required = true),
		@ApiImplicitParam(name = "pricing", required = true),
		@ApiImplicitParam(name = "primaryKeyWord", required = true),
		@ApiImplicitParam(name = "priority", required = true),
		@ApiImplicitParam(name = "productIds", required = true),
		@ApiImplicitParam(name = "publish", required = true),
		@ApiImplicitParam(name = "recommendation", required = true),
		@ApiImplicitParam(name = "recommendationCopy", required = true),
		@ApiImplicitParam(name = "rightType", required = true),
		@ApiImplicitParam(name = "scarcity", required = true),
		@ApiImplicitParam(name = "sceneFiles", required = true),
		@ApiImplicitParam(name = "scope", required = true),
		@ApiImplicitParam(name = "score", required = true),
		@ApiImplicitParam(name = "sequence", required = true),
		@ApiImplicitParam(name = "serialContentId", required = true),
		@ApiImplicitParam(name = "serialCount", required = true),
		@ApiImplicitParam(name = "serialSequence", required = true),
		@ApiImplicitParam(name = "serialTrailingSequence", required = true),
		@ApiImplicitParam(name = "shortName", required = true),
		@ApiImplicitParam(name = "stage", required = true),
		@ApiImplicitParam(name = "status", required = true),
		@ApiImplicitParam(name = "support", required = true),
		@ApiImplicitParam(name = "syncFilePath", required = true),
		@ApiImplicitParam(name = "terminal", required = true),
		@ApiImplicitParam(name = "tvEndDate", required = true),
		@ApiImplicitParam(name = "type", required = true),
		@ApiImplicitParam(name = "udid", required = true),
		@ApiImplicitParam(name = "unitPricing", required = true),
		@ApiImplicitParam(name = "updateFields", required = true),
		@ApiImplicitParam(name = "version", required = true),
		@ApiImplicitParam(name = "waterMask", required = true),
		@ApiImplicitParam(name = "way", required = true),
		@ApiImplicitParam(name = "worksType", required = true),
		@ApiImplicitParam(name = "movedPlatform", required = true),
		@ApiImplicitParam(name = "webpFlag", required = true),
		@ApiImplicitParam(name = "lastTranscodeTime", required = true),
		@ApiImplicitParam(name = "miguDbid", required = true),
		@ApiImplicitParam(name = "mvId", required = true),
		@ApiImplicitParam(name = "mpId", required = true),
		@ApiImplicitParam(name = "mcId", required = true),
		@ApiImplicitParam(name = "liveContentId", required = true),
		@ApiImplicitParam(name = "playBillEndTime", required = true),
		@ApiImplicitParam(name = "playBillStartTime", required = true),
		@ApiImplicitParam(name = "contentMediaStatus", required = true),
		@ApiImplicitParam(name = "dialect", required = true),
		@ApiImplicitParam(name = "streamId", required = true),
		@ApiImplicitParam(name = "contentMediaReason", required = true),
		@ApiImplicitParam(name = "cdiId", required = true),
		@ApiImplicitParam(name = "checkStatus", required = true),
		@ApiImplicitParam(name = "hotContId", required = true),
		@ApiImplicitParam(name = "isEnforePreview", required = true),
		@ApiImplicitParam(name = "isLock", required = true),
		@ApiImplicitParam(name = "isOutput", required = true),
		@ApiImplicitParam(name = "ispublished", required = true),
		@ApiImplicitParam(name = "isSupRcHd", required = true),
		@ApiImplicitParam(name = "nodeId", required = true),
		@ApiImplicitParam(name = "publishTime", required = true),
		@ApiImplicitParam(name = "remarkText", required = true),
		@ApiImplicitParam(name = "tags", required = true),
		@ApiImplicitParam(name = "updateTime", required = true),
		@ApiImplicitParam(name = "userId", required = true),
		@ApiImplicitParam(name = "userName", required = true),
		@ApiImplicitParam(name = "inputUserid", required = true),
		@ApiImplicitParam(name = "isPrivate", required = true),
		@ApiImplicitParam(name = "keyWordsCopy", required = true),
		@ApiImplicitParam(name = "miguDbId", required = true),
		@ApiImplicitParam(name = "isPublishFirst", required = true),
		@ApiImplicitParam(name = "superBcId", required = true),
		@ApiImplicitParam(name = "superBcType", required = true),
		@ApiImplicitParam(name = "svId", required = true),
		@ApiImplicitParam(name = "dataObjId", required = true),
		@ApiImplicitParam(name = "preRecord", required = true),
		@ApiImplicitParam(name = "thumbViewer", required = true),
		@ApiImplicitParam(name = "liveScreenShot", required = true),
		@ApiImplicitParam(name = "isMultilinGual", required = true),
	})
	@PostMapping(value = "/add")
	@ResponseBody
	//TODO (需要删除不需要的属性列)
	public ResultBean add(HttpServletRequest request, ContentVo contentVo) {
		List<String> messageList = ValidateFilter.getFilterMessage(contentVo, Constants.VALIDATE_DEFAULT);
		if (!messageList.isEmpty()) {
			return ResultBean.error(messageList.toString());
		}
		
		if (isRepeat(contentVo)) 
			return ResultBean.error(MessageCodes.get(MessageCodes.M980202));
	
		Content content = new Content();
		BeanUtils.copyProperties(contentVo, content);
		
		//content.putTimeAndUser(content);
		contentService.save(content);
		return ResultBean.ok(content);
	}
	
	*/
/**
	 * <p><b>Title:</b> isRepeat</p>
	 * <p><b>Description:</b> 判断名称是否重复</p>
	 * @author douzi
	 * @param contentVo
	 *//*

	private boolean isRepeat(ContentVo contentVo) {
		*/
/*Content temp = new Content();
		temp.setName(contentVo.getName());
		Optional<Content> contentOpt = contentService.findOne(Example.of(temp));
		if (contentOpt.isPresent()) {
			Content content = contentOpt.get();
			if (contentVo.getId() != null && contentVo.getId() != content.getId())
				return true;
			else if (contentVo.getId() == null)
				return true;
		}*//*

		return false;
	}
	
	@ApiOperation("详情")
	@ApiImplicitParam(name = "id", required = true, paramType = "query", dataType = "Long")
	@GetMapping(value = "/get")
	@ResponseBody
	public ResultBean get(Long id) {
		Content content = contentService.get(id);
		return ResultBean.ok(content);
	}
	
	@ApiOperation("变更")
	@ApiImplicitParams({
		@ApiImplicitParam(name = "id", required = true),
		@ApiImplicitParam(name = "accessPlatformType", required = true),
		@ApiImplicitParam(name = "area", required = true),
		@ApiImplicitParam(name = "areaId", required = true),
		@ApiImplicitParam(name = "assetId", required = true),
		@ApiImplicitParam(name = "assist", required = true),
		@ApiImplicitParam(name = "auditionRecordsNum", required = true),
		@ApiImplicitParam(name = "author", required = true),
		@ApiImplicitParam(name = "authorizationWay", required = true),
		@ApiImplicitParam(name = "bcId", required = true),
		@ApiImplicitParam(name = "bcLicense", required = true),
		@ApiImplicitParam(name = "bcPriority", required = true),
		@ApiImplicitParam(name = "bcRatio", required = true),
		@ApiImplicitParam(name = "beginDate", required = true),
		@ApiImplicitParam(name = "blackArea", required = true),
		@ApiImplicitParam(name = "businessLicense", required = true),
		@ApiImplicitParam(name = "cacheCdnStatus", required = true),
		@ApiImplicitParam(name = "category", required = true),
		@ApiImplicitParam(name = "cdnStatus", required = true),
		@ApiImplicitParam(name = "cduration", required = true),
		@ApiImplicitParam(name = "chain", required = true),
		@ApiImplicitParam(name = "clarity", required = true),
		@ApiImplicitParam(name = "cmsId", required = true),
		@ApiImplicitParam(name = "contSourceStatus", required = true),
		@ApiImplicitParam(name = "contentId", required = true),
		@ApiImplicitParam(name = "contentLevel", required = true),
		@ApiImplicitParam(name = "contentLists", required = true),
		@ApiImplicitParam(name = "contentPlayTime", required = true),
		@ApiImplicitParam(name = "copy", required = true),
		@ApiImplicitParam(name = "copyrightCpid", required = true),
		@ApiImplicitParam(name = "copyrightObjectId", required = true),
		@ApiImplicitParam(name = "copyrightType", required = true),
		@ApiImplicitParam(name = "copyrightId", required = true),
		@ApiImplicitParam(name = "cpId", required = true),
		@ApiImplicitParam(name = "cpRatio", required = true),
		@ApiImplicitParam(name = "createTime", required = true),
		@ApiImplicitParam(name = "creatorId", required = true),
		@ApiImplicitParam(name = "detail", required = true),
		@ApiImplicitParam(name = "detailCopy", required = true),
		@ApiImplicitParam(name = "directRecFlag", required = true),
		@ApiImplicitParam(name = "displayFileLists", required = true),
		@ApiImplicitParam(name = "displayName", required = true),
		@ApiImplicitParam(name = "displayType", required = true),
		@ApiImplicitParam(name = "distResult", required = true),
		@ApiImplicitParam(name = "docName", required = true),
		@ApiImplicitParam(name = "doubanId", required = true),
		@ApiImplicitParam(name = "endDate", required = true),
		@ApiImplicitParam(name = "feeType", required = true),
		@ApiImplicitParam(name = "formType", required = true),
		@ApiImplicitParam(name = "gslbStatus", required = true),
		@ApiImplicitParam(name = "hasMoved", required = true),
		@ApiImplicitParam(name = "hasVideo", required = true),
		@ApiImplicitParam(name = "images", required = true),
		@ApiImplicitParam(name = "influence", required = true),
		@ApiImplicitParam(name = "integrity", required = true),
		@ApiImplicitParam(name = "isMultiScreen", required = true),
		@ApiImplicitParam(name = "isSupH264", required = true),
		@ApiImplicitParam(name = "isSupRchd", required = true),
		@ApiImplicitParam(name = "isSupRms", required = true),
		@ApiImplicitParam(name = "isSupWap", required = true),
		@ApiImplicitParam(name = "isSupWww", required = true),
		@ApiImplicitParam(name = "isUpdating", required = true),
		@ApiImplicitParam(name = "keyWords", required = true),
		@ApiImplicitParam(name = "keywordsCopy", required = true),
		@ApiImplicitParam(name = "labels", required = true),
		@ApiImplicitParam(name = "lastModifyTime", required = true),
		@ApiImplicitParam(name = "liveType", required = true),
		@ApiImplicitParam(name = "mediaFileLists", required = true),
		@ApiImplicitParam(name = "mediaLevel", required = true),
		@ApiImplicitParam(name = "miguPublish", required = true),
		@ApiImplicitParam(name = "miguRank", required = true),
		@ApiImplicitParam(name = "monthPricing", required = true),
		@ApiImplicitParam(name = "movieLibId", required = true),
		@ApiImplicitParam(name = "name", required = true),
		@ApiImplicitParam(name = "nameCopy", required = true),
		@ApiImplicitParam(name = "nCpid", required = true),
		@ApiImplicitParam(name = "needDrm", required = true),
		@ApiImplicitParam(name = "onlineTime", required = true),
		@ApiImplicitParam(name = "optimal", required = true),
		@ApiImplicitParam(name = "oriPublish", required = true),
		@ApiImplicitParam(name = "output", required = true),
		@ApiImplicitParam(name = "playbillFilePath", required = true),
		@ApiImplicitParam(name = "pricing", required = true),
		@ApiImplicitParam(name = "primaryKeyWord", required = true),
		@ApiImplicitParam(name = "priority", required = true),
		@ApiImplicitParam(name = "productIds", required = true),
		@ApiImplicitParam(name = "publish", required = true),
		@ApiImplicitParam(name = "recommendation", required = true),
		@ApiImplicitParam(name = "recommendationCopy", required = true),
		@ApiImplicitParam(name = "rightType", required = true),
		@ApiImplicitParam(name = "scarcity", required = true),
		@ApiImplicitParam(name = "sceneFiles", required = true),
		@ApiImplicitParam(name = "scope", required = true),
		@ApiImplicitParam(name = "score", required = true),
		@ApiImplicitParam(name = "sequence", required = true),
		@ApiImplicitParam(name = "serialContentId", required = true),
		@ApiImplicitParam(name = "serialCount", required = true),
		@ApiImplicitParam(name = "serialSequence", required = true),
		@ApiImplicitParam(name = "serialTrailingSequence", required = true),
		@ApiImplicitParam(name = "shortName", required = true),
		@ApiImplicitParam(name = "stage", required = true),
		@ApiImplicitParam(name = "status", required = true),
		@ApiImplicitParam(name = "support", required = true),
		@ApiImplicitParam(name = "syncFilePath", required = true),
		@ApiImplicitParam(name = "terminal", required = true),
		@ApiImplicitParam(name = "tvEndDate", required = true),
		@ApiImplicitParam(name = "type", required = true),
		@ApiImplicitParam(name = "udid", required = true),
		@ApiImplicitParam(name = "unitPricing", required = true),
		@ApiImplicitParam(name = "updateFields", required = true),
		@ApiImplicitParam(name = "version", required = true),
		@ApiImplicitParam(name = "waterMask", required = true),
		@ApiImplicitParam(name = "way", required = true),
		@ApiImplicitParam(name = "worksType", required = true),
		@ApiImplicitParam(name = "movedPlatform", required = true),
		@ApiImplicitParam(name = "webpFlag", required = true),
		@ApiImplicitParam(name = "lastTranscodeTime", required = true),
		@ApiImplicitParam(name = "miguDbid", required = true),
		@ApiImplicitParam(name = "mvId", required = true),
		@ApiImplicitParam(name = "mpId", required = true),
		@ApiImplicitParam(name = "mcId", required = true),
		@ApiImplicitParam(name = "liveContentId", required = true),
		@ApiImplicitParam(name = "playBillEndTime", required = true),
		@ApiImplicitParam(name = "playBillStartTime", required = true),
		@ApiImplicitParam(name = "contentMediaStatus", required = true),
		@ApiImplicitParam(name = "dialect", required = true),
		@ApiImplicitParam(name = "streamId", required = true),
		@ApiImplicitParam(name = "contentMediaReason", required = true),
		@ApiImplicitParam(name = "cdiId", required = true),
		@ApiImplicitParam(name = "checkStatus", required = true),
		@ApiImplicitParam(name = "hotContId", required = true),
		@ApiImplicitParam(name = "isEnforePreview", required = true),
		@ApiImplicitParam(name = "isLock", required = true),
		@ApiImplicitParam(name = "isOutput", required = true),
		@ApiImplicitParam(name = "ispublished", required = true),
		@ApiImplicitParam(name = "isSupRcHd", required = true),
		@ApiImplicitParam(name = "nodeId", required = true),
		@ApiImplicitParam(name = "publishTime", required = true),
		@ApiImplicitParam(name = "remarkText", required = true),
		@ApiImplicitParam(name = "tags", required = true),
		@ApiImplicitParam(name = "updateTime", required = true),
		@ApiImplicitParam(name = "userId", required = true),
		@ApiImplicitParam(name = "userName", required = true),
		@ApiImplicitParam(name = "inputUserid", required = true),
		@ApiImplicitParam(name = "isPrivate", required = true),
		@ApiImplicitParam(name = "keyWordsCopy", required = true),
		@ApiImplicitParam(name = "miguDbId", required = true),
		@ApiImplicitParam(name = "isPublishFirst", required = true),
		@ApiImplicitParam(name = "superBcId", required = true),
		@ApiImplicitParam(name = "superBcType", required = true),
		@ApiImplicitParam(name = "svId", required = true),
		@ApiImplicitParam(name = "dataObjId", required = true),
		@ApiImplicitParam(name = "preRecord", required = true),
		@ApiImplicitParam(name = "thumbViewer", required = true),
		@ApiImplicitParam(name = "liveScreenShot", required = true),
		@ApiImplicitParam(name = "isMultilinGual", required = true),
	})
	@PutMapping(value = "/edit")
	@ResponseBody
	//TODO (需要删除不需要的属性列)
	public ResultBean update(HttpServletRequest request, ContentVo contentVo) {
		List<String> messageList = ValidateFilter.getFilterMessage(contentVo, Constants.VALIDATE_UPDATE);
		if (!messageList.isEmpty()) {
			return ResultBean.error(messageList.toString());
		}
		
		*/
/*if (isRepeat(contentVo))
			return ResultBean.error(MessageCodes.get(MessageCodes._900001));*//*

		
		Content content = new Content();
		BeanUtils.copyProperties(contentVo, content);
		return ResultBean.ok(contentService.merge(content));
	}
	
	@ApiOperation("删除")
	@ApiImplicitParam(name = "id", required = true, paramType = "query", dataType = "Long")
	@DeleteMapping(value = "/del")
	@ResponseBody
	public ResultBean delete(Long id) {
		contentService.deleteById(id);
		return ResultBean.ok();
	}
}
*/
